﻿using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using AB.ServiceDirectory.Entities;
using AB.ServiceDirectory.BO;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory;

namespace AB.ServiceDirectory.TestScripts
{
    [TestFixture]
    public class HungContactBoUnitTest
    {
        //This is for comparing two objects type of Contact
        private class ContactComparer : IEqualityComparer<Contact>
        {
            public bool Equals(Contact x, Contact y)
            {
                return (x.ContactId == y.ContactId) && (x.FirstName == y.FirstName) &&
                       (x.Surname == y.Surname) && (x.KnownAs == y.KnownAs) &&
                       (x.OfficePhone == y.OfficePhone) && (x.MobilePhone == y.MobilePhone) &&
                       (x.HomePhone == y.HomePhone) && (x.Email == y.Email) &&
                       (x.ManageId == y.ManageId) && (x.ContactTypeId == y.ContactTypeId) &&
                       (x.BestContactMethodId == y.BestContactMethodId) && (x.JobRole == y.JobRole) &&
                       (x.WorkBase == y.WorkBase) && (x.JobTitle == y.JobTitle) && (x.IsActive == y.IsActive);
            }
            public int GetHashCode(Contact obj)
            {
                throw new NotImplementedException();
            }
        }

        private string _sortType;
        private int _startRowIndex;
        private int _maxRows;

        /// <summary>
        /// Setups this instance.
        /// </summary>
        [SetUp]
        public void Setup()
        {
            _sortType = "ContactName";  //sortExpression="ContactName"
            _startRowIndex = 0;  //from rowindex=0
            _maxRows = 15;  //take 15 records
        }

        #region SelectContactById

        /// <summary>
        /// Tests the select contact by id_ input exist contact id_ return A contact.
        /// </summary>
        [Test]
        public void TestSelectContactById_InputExistContactId_ReturnAContact()
        {
            var expectedContact = new Contact
                                      {
                                          ContactId = 68,
                                          FirstName = "Lydia",
                                          Surname = "Mayer",
                                          KnownAs = "TNZL13",
                                          OfficePhone = "971-297-2307",
                                          MobilePhone = "483-0280303",
                                          HomePhone = "224-295-1261",
                                          Email = "nagnxhfa.sheltaor@zqvqtcpz.aer-vs.com",
                                          ManageId = 28,
                                          ContactTypeId = 2,
                                          BestContactMethodId = 4,
                                          JobRole = "26",
                                          WorkBase = "M7N2BT13FF6YTF0FPTXX5ADKETKZOWHHFEQEXB7",
                                          JobTitle = "Dr",
                                          IsActive = true
                                      };
            var actualContact = BO.HungContactBO.SelectContactById(68);
            Assert.IsTrue(new ContactComparer().Equals(expectedContact, actualContact));
        }

        /// <summary>
        /// Tests the select contact by id_ input not exist contact id_ return null.
        /// </summary>
        [Test]
        public void TestSelectContactById_InputNotExistContactId_ReturnNull()
        {
            int notexistContactId = -1;
            Assert.IsNull(BO.HungContactBO.SelectContactById(notexistContactId));
        }

        #endregion

        #region SelectAllContactTypes
        /// <summary>
        /// Tests the type of the select all contact types_ return contact.
        /// </summary>
        [Test]
        public void TestSelectAllContactTypes_ReturnAllContactType()
        {
            var actualContactTypeRowCount = BO.HungContactBO.SelectAllContactTypes().Count;
            Assert.GreaterOrEqual(actualContactTypeRowCount, 0);
        }
        #endregion

        #region SelectAllBestMethodContact
        /// <summary>
        /// Tests the select all best method contact_ return all best method contact.
        /// </summary>
        [Test]
        public void TestSelectAllBestMethodContact_ReturnAllBestMethodContact()
        {
            var actualContactTypeRowCount = BO.HungContactBO.SelectAllContactTypes().Count;
            Assert.GreaterOrEqual(actualContactTypeRowCount, 0);
        }
        #endregion

        #region GetListCount

        [Test]
        public void TestGetListCount1_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
                             {
                                 FirstName = firstname,
                                 Surname=Surname,
                                 IncludeInactiveContact = true  //InclueActiveContact parameter
                             };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount,0);
        }
        [Test]
        public void TestGetListCount2_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount3_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount4_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount5_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount6_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount7_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount8_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount9_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount10_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount11_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount12_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount13_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount14_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount15_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount16_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount17_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetListCount18_InputFilter_ReturnContactRowCount()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }

        #endregion

        #region GetList

        [Test]
        public void TestGetList1_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter,_sortType,_startRowIndex,_maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList2_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter,_sortType,_startRowIndex,_maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList3_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList4_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList5_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList6_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "Lydia";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList7_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList8_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList9_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList10_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList11_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList12_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "notexistfirstname";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList13_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetListCount(filter);
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList14_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "Mayer";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList15_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.AreEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList16_InputFilter_ReturnNull()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "notexistSurname";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = false  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList17_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter, _sortType, _startRowIndex, _maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        [Test]
        public void TestGetList18_InputFilter_ReturnListContact()
        {
            //data from record in which contactId=68
            string firstname = "";
            string Surname = "";

            var filter = new Commons.DataFilters.HContactFilter()
            {
                FirstName = firstname,
                Surname = Surname,
                IncludeInactiveContact = true  //InclueActiveContact parameter
            };

            int expectedRowCount = BO.HungContactBO.GetList(filter,_sortType,_startRowIndex,_maxRows).Count;
            Assert.GreaterOrEqual(expectedRowCount, 0);
        }
        #endregion

        #region InsertContact
        /// <summary>
        /// Tests the insert contact_ input contact_ return boolean.
        /// </summary>
        [Test]
        public void TestInsertContact1_InputContact_ReturnTrue()
        {
            var contact = new Contact
                              {   //madatory fields
                                  FirstName = "Hung",
                                  Surname = "Nguyen",
                                  ContactTypeId = 1,

                                  //optional fields
                                  KnownAs = "HungND12",
                                  OfficePhone = "001122",
                                  HomePhone = "001122",
                                  MobilePhone = "001122",
                                  Email = "HungND12@fsoft.com.vn",
                                  ManageId = 1,
                                  BestContactMethodId = 1,
                                  JobRole = "Developer",
                                  WorkBase = "Hanoi",
                                  JobTitle = "Fresher",
                                  IsActive = true
                              };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsTrue(actualResult);
        }

        [Test]
        public void TestInsertContact2_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = "Hung",
                Surname = "Nguyen",
                //ContactTypeId =null

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact3_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = "Hung",
                Surname = null,
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact4_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = "Hung",
                Surname = null,
                //ContactTypeId =null

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact5_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = null,
                Surname = "Nguyen",
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact6_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = null,
                Surname = "Nguyen",
                //ContactTypeId =null

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact7_InputContactReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = null,
                Surname = null,
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        [Test]
        public void TestInsertContact8_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {   //madatory fields
                FirstName = null,
                Surname = null,
                //ContactTypeId =null

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            bool actualResult = BO.HungContactBO.InsertContact(contact);
            Assert.IsFalse(actualResult);
        }

        #endregion

        #region UpdateContact
        /// <summary>
        /// Tests case 1
        /// </summary>
        [Test]
        public void TestUpdateContact1_InputContact_ReturnTrue()
        {
           
            var contact = new Contact
                                     {
                                         ContactId = 2,
                                         //madatory fields
                                         FirstName = "Hung1",
                                         Surname = "Nguyen Dinh",
                                         ContactTypeId= 1,

                                         //optional fields
                                         KnownAs = "HungND12",
                                         OfficePhone = "001122",
                                         HomePhone = "001122",
                                         MobilePhone = "001122",
                                         Email = "HungND12@fsoft.com.vn",
                                         ManageId = 1,
                                         BestContactMethodId=1,
                                         JobRole = "Developer",
                                         WorkBase = "Hanoi",
                                         JobTitle = "Fresher",
                                         IsActive = true
                                     };
            Assert.IsTrue(HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 2
        /// </summary>
        [Test]
        public void TestUpdateContact2_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = "Hung",
                Surname = "Nguyen Dinh",
                //ContactTypeId = null,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 3
        /// </summary>
        [Test]
        public void TestUpdateContact3_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = "Hung",
                Surname = null,
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 4
        /// </summary>
        [Test]
        public void TestUpdateContact4_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = "Hung",
                Surname = null,
                //ContactTypeId = null,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 5
        /// </summary>
        [Test]
        public void TestUpdateContact5_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName =null,
                Surname = "Nguyen Dinh",
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 6
        /// </summary>
        [Test]
        public void TestUpdateContact6_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = null,
                Surname = "Nguyen Dinh",
                //ContactTypeId = null,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 7
        /// </summary>
        [Test]
        public void TestUpdateContact7_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = null,
                Surname = null,
                ContactTypeId = 1,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        /// <summary>
        /// Test case 8
        /// </summary>
        [Test]
        public void TestUpdateContact8_InputContact_ReturnFalse()
        {
            var contact = new Contact
            {
                ContactId = 3,
                //madatory fields
                FirstName = null,
                Surname = null,
                //ContactTypeId = null,

                //optional fields
                KnownAs = "HungND12",
                OfficePhone = "001122",
                HomePhone = "001122",
                MobilePhone = "001122",
                Email = "HungND12@fsoft.com.vn",
                ManageId = 1,
                BestContactMethodId = 1,
                JobRole = "Developer",
                WorkBase = "Hanoi",
                JobTitle = "Fresher",
                IsActive = true
            };
            Assert.IsFalse(BO.HungContactBO.UpdateContact(contact));
        }

        #endregion
    }
}
